
#include <iostream>
using namespace std;

class Circle;

class Point
{
    friend class Circle;
public:
    Point(double x, double y);
    ~Point();
private:
    double x;
    double y;
};

Point::Point(double x, double y) : x(x), y(y)
{
    cout << "Point()" << endl;
}

Point::~Point()
{
    cout << "~Point()" << endl;
}




class Circle
{
public:
    Circle();
    ~Circle();
    void printPoint(const Point& p);
private:
  // 类中实例化 Point 对象
    Point point;
};

Circle::Circle() : point(7, 8)
{
    cout << "Circle()" << endl;
}

Circle::~Circle()
{
    cout << "~Circle()" << endl;
}

// 友元成员函数
void Circle::printPoint(const Point& p)
{
    // 由于声明为友元函数，可以直接访问 Point 类成员
    cout << "Point(" << p.x << ", " << p.y << ")\n";
}

int main()
{
    Point p(5, 6);
    Circle c;
    // Circle 类成员函数访问 Point 类成员
    c.printPoint(p);


    return 0;
}